import { axios } from '@/utils/request'

export function editPassword (id, old, np) {
  return axios({
    url: '/setting/password',
    method: 'post',
    data: {
      id: id,
      old: old,
      np: np
    }
  })
}

export function editPhone (id, telephone, captcha) {
  return axios({
    url: '/setting/phone',
    method: 'post',
    data: {
      id: id,
      telephone: telephone,
      captcha: captcha
    }
  })
}

export function getCaptcha (telephone) {
  return axios({
    url: '/setting/captcha',
    method: 'get',
    params: {
      telephone: telephone
    }
  })
}

export function editEmail (id, email) {
  return axios({
    url: '/setting/email',
    method: 'post',
    data: {
      id: id,
      email: email
    }
  })
}

export function editUsername (id, username) {
  return axios({
    url: '/setting/username',
    method: 'post',
    data: {
      id: id,
      username: username
    }
  })
}
